/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Items;

import ElementsProperties.Dropable;
import ElementsProperties.ActivableOnCollision;
import Actors.Actor;
import Actors.HumanControlledBall;
import ElementsProperties.ActorEntranceSensible;
import Model.CollisionEvent;
import Stones.LockedStone;

/**
 *
 * @author vf
 */
public class Key extends Item implements Dropable,ActivableOnCollision,ActorEntranceSensible{

    @Override
    public void update(long dtime) {
    }

    @Override
    public void setImage() {
        itemImage=EnigmaUtils.ImageLoader.loadImage("./images/it-key.png");
    }

    public void droped() {
    }

    public void collisionOccured(CollisionEvent e) {
        if(e.getCase().getStone() instanceof LockedStone){
            LockedStone stone = (LockedStone) e.getCase().getStone();
            stone.insertKey();
            inventory.removeItem(this);
        }
    }

    public void collected() {
    }

    public boolean isCollectable() {
        return true;
    }

    public void actorEnters(Actor a) {
        if(a instanceof HumanControlledBall)
            goToInventory();
    }

    public void actorLeaves(Actor a) {
    }

}
